package cn.zjj.fallbackfactory;

import cn.zjj.domain.User;
import cn.zjj.feignClient.UserFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User selectById(Long id) {
                return new User(-1L,"发生了熔断","openfeign的方式");
            }
        };
    }
}
